package com.zto.mybatis.custom2.executor;


import com.zto.mybatis.custom2.config.MapperRegistory;
import com.zto.mybatis.custom2.config.MyConfiguration;
import com.zto.mybatis.custom2.statement.StatementHandler;

/**
 * Created by xingyuchao on 2017-07-09.
 */
public class SimpleExecutor implements Executor{

    private MyConfiguration configuration;

    public SimpleExecutor() {
    }

    public SimpleExecutor(MyConfiguration configuration) {
        this.configuration = configuration;
    }

    public void setConfiguration(MyConfiguration configuration) {
        this.configuration = configuration;
    }




    public <T> T query(MapperRegistory.MapperData mapperData, Object parameter) throws Exception {
        //初始化StatementHandler --> ParameterHandler --> ResultSetHandler
        StatementHandler handler = new StatementHandler(configuration);
        return handler.query(mapperData,parameter);
    }
}
